package net.gdface.sdk.decorator;
import net.gdface.thrift.ThriftDecorator;
import com.facebook.swift.codec.ThriftStruct;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftField.Requiredness;
/**
 * decorator pattern 装饰者模式代理{@link net.gdface.sdk.FInt2}<br>
 * 代理对象必须有默认构造方法,必须是普通类型,不可以有@ThriftStruct注释<br>
 * 转发所有{@link net.gdface.sdk.FInt2}get/set方法到{@link #delegate()}指定的实例,<br>
 * 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)<br>
 * @author guyadong
 *
 */
@ThriftStruct
public final class FInt2 implements ThriftDecorator<net.gdface.sdk.FInt2> {
    private final net.gdface.sdk.FInt2 delegate;
    
    public FInt2(){
        this(new net.gdface.sdk.FInt2());
    }
    public FInt2(net.gdface.sdk.FInt2 delegate) {
        if(null == delegate){
            throw new NullPointerException("delegate is null");
        }
        // 检查被装饰类是否有@ThriftStruct注释
        if(delegate.getClass().isAnnotationPresent(ThriftStruct.class)){
            throw new IllegalArgumentException(
                String.format("NOT ALLOW %s have @ThriftStruct annotation",delegate.getClass().getName()));
        }
        this.delegate = delegate;
    }

    /**
     * 返回被装饰的{@link net.gdface.sdk.FInt2}实例
     * @return
     */
    @Override
    public net.gdface.sdk.FInt2 delegate() {
        return delegate;
    }
    @Override
    public int hashCode() {
        return delegate().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        return delegate().equals(obj);
    }
    @Override
    public String toString() {
        return delegate().toString();
    }
    @ThriftField(value = 1,requiredness=Requiredness.REQUIRED)
    public int getX(){
        return delegate().getX();
    }
    
    @ThriftField
    public void setX(int value){
        delegate().setX(value);
    }

    @ThriftField(value = 2,requiredness=Requiredness.REQUIRED)
    public int getY(){
        return delegate().getY();
    }
    
    @ThriftField
    public void setY(int value){
        delegate().setY(value);
    }

}